﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SwertressSMS.helper;

namespace SwertressSMS
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();        
            
            //register button click listener
            //side button
            this.BtnBet.Click += new EventHandler(button_click);
            this.BtnCoordinator.Click += new EventHandler(button_click);
            this.BtnRemittance.Click += new EventHandler(button_click);
            this.BtnExit.Click += new EventHandler(button_click);

            //coordinator
            this.BtnAddNewCoordinator.Click += new EventHandler(button_coordinator_click);
            this.BtnEditCoordinator.Click += new EventHandler(button_coordinator_click);
            this.BtnActivateDeactive.Click += new EventHandler(button_coordinator_click);

            //remittance
            this.BtnAddNewRemittance.Click += new EventHandler(button_remittance_click);
            this.BtnEditRemittance.Click += new EventHandler(button_remittance_click);
            
            //bet
           // this.BtnShowTally.Click += new EventHandler(button_bet_click);
           // this.BtnShowBet.Click += new EventHandler(button_bet_click);
            

        }
        protected void button_click(object sender, EventArgs e)
        {
            //cast object to button control
            Button btn_ref = (Button)sender;
            if ( btn_ref.Name == "BtnCoordinator" )
            {
            }
            else if ( btn_ref.Name == "BtnRemittance")
            {
            }
            else if ( btn_ref.Name == "BtnBet")
            {
            }
            else if (btn_ref.Name == "BtnExit")
            {
                Application.Exit();
            }
        }
        protected void button_coordinator_click(object sender, EventArgs e)
        {
            Button btn_ref = (Button)sender;
        }
        protected void button_remittance_click(object sender, EventArgs e)
        {
            Button btn_ref = (Button)sender;
        }
        protected void button_bet_click(object sender, EventArgs e)
        {
            Button btn_ref = (Button)sender;
        }
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            //exit application
            Application.Exit();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //get datetime reference
            DateTime now = DateTime.Now;

            //get datepart
            int year = now.Year;
            int month = now.Month;
            int day = now.Day;
            //get timepart
            int hour = now.Hour;            
            int min = now.Minute;
            int sec = now.Second;
            string mer = ( (hour < 12) ? "AM" : "PM" );

            hour = ( hour == 0 || hour == 12 ) ? 12 : ( hour < 12 ? hour : ( hour - 12 ) );
            

            //show current date
            LblDate.Text = ((month.ToString().Length == 1 ? "0" : "") + month.ToString()) + "/" + ((day.ToString().Length == 1 ? "0" : "") + day.ToString()) + "/" + year;
            //show current time
            LblTime.Text = (( hour.ToString().Length == 1 ? "0" : "" ) + hour.ToString()) + ":" + (( min.ToString().Length == 1 ? "0" : "" ) + min.ToString() ) + ":" + (( sec.ToString().Length == 1 ? "0" : "" ) + sec.ToString()) + " " + mer;
            
        }

        private void label14_Click(object sender, EventArgs e)
        {

        }

        private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
        {

        }
       
    }
}
